package com.wva.video.controller;

import cn.hutool.core.bean.BeanUtil;
import com.wva.common.utils.R;
import com.wva.video.domain.po.VideoCategory;
import com.wva.video.domain.vo.VideoCategoryVO;
import com.wva.video.service.VideoCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: hong
 * @Date: 2025/2/16 00:00:24
 */
@Api(tags = "视频分类相关接口")
@RequestMapping("/video/category")
@RestController
public class CategoryController {
    @Autowired
    VideoCategoryService videoCategoryService;

    @ApiOperation("查询所有分类")
    @GetMapping("/list/all")
    R<List<VideoCategoryVO>> listAll() {
        List<VideoCategory> list = videoCategoryService.list();
        List<VideoCategoryVO> categories = BeanUtil.copyToList(list, VideoCategoryVO.class);
        return R.ok(categories);
    }
}
